package missPuff.com;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.com.SeasonInfo;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class TitleGalleryAdapter extends BaseAdapter {

	private Map<Integer, View> rowViews = new HashMap<Integer, View>();
	private List<SeasonInfo> list;
	private Context context;
	
	public TitleGalleryAdapter(Context context,
			List<SeasonInfo> seasonInfos) {
		// TODO Auto-generated constructor stub
		this.context = context;
		this.list = seasonInfos;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View rowView = rowViews.get(position);
		if(rowView == null){
			LayoutInflater layoutInflater = LayoutInflater.from(context);
			rowView = layoutInflater.inflate(R.layout.titlegallery_item, null);
			TextView title_name = (TextView) rowView.findViewById(R.id.title_name);
			title_name.setText(list.get(position).getSeason_title());
		}
		
		return rowView;
	}

}
